package cn.e4j.modular.crm.service.impl;

import cn.e4j.core.dto.impl.Dto;
import cn.e4j.core.util.StringUtils;
import cn.e4j.modular.crm.entity.MmrdT;
import cn.e4j.modular.crm.mapper.Gwai741Mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 设备维修保养记录查询 服务实现类
 *
 * @author yuan_rz
 * @since 2019-12-23
 */
@Service
public class Gwai741ServiceImpl extends ServiceImpl<Gwai741Mapper, MmrdT>{

    @Transactional(readOnly = true)
    public List<Dto> getListData(Page<Object> page, Dto dto) {
        List<Dto> listData = this.baseMapper.getListData(page, dto);
        for(Dto data : listData){
            data.put("DOCNO", data.getString("MMRGDOCNO"));
            data.put("ENT", dto.getString("ENT"));
            data.put("LANG", dto.getString("LANG"));
            data.put("MMRQ001", StringUtils.join(this.baseMapper.getFaultListData(data), ","));
        }
        return listData;
    }

}
